package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.InPay;
import cn.wolfcode.crm.mapper.InPayMapper;
import cn.wolfcode.crm.query.InPayQueryObject;
import cn.wolfcode.crm.service.IInPayService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class InPayServiceImpl implements IInPayService {

    @Autowired
    private InPayMapper inPayMapper;

    @Override
    public void insert(Long outpayId){
        inPayMapper.insert(outpayId);
    }

    @Override
    public PageResult query(InPayQueryObject qo) {
        int total = inPayMapper.query4Count(qo);
        if(total == 0 ){
            return new PageResult(0, Collections.EMPTY_LIST);
        }
        List<InPay> rows = inPayMapper.query4List(qo);
        return new PageResult(total,rows);
    }
}
